﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Rendering.RenderTargetBinding
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

#nullable disable
namespace UnityEngine.Rendering
{
  /// <summary>
  ///   <para>Describes a render target with one or more color buffers, a depthstencil buffer and the associated loadstore-actions that are applied when the render target is active.</para>
  /// </summary>
  public struct RenderTargetBinding
  {
    private RenderTargetIdentifier[] m_ColorRenderTargets;
    private RenderTargetIdentifier m_DepthRenderTarget;
    private RenderBufferLoadAction[] m_ColorLoadActions;
    private RenderBufferStoreAction[] m_ColorStoreActions;
    private RenderBufferLoadAction m_DepthLoadAction;
    private RenderBufferStoreAction m_DepthStoreAction;
    private RenderTargetFlags m_Flags;

    /// <summary>
    ///   <para>Color buffers to use as render targets.</para>
    /// </summary>
    public RenderTargetIdentifier[] colorRenderTargets
    {
      get => this.m_ColorRenderTargets;
      set => this.m_ColorRenderTargets = value;
    }

    /// <summary>
    ///   <para>Depth/stencil buffer to use as render target.</para>
    /// </summary>
    public RenderTargetIdentifier depthRenderTarget
    {
      get => this.m_DepthRenderTarget;
      set => this.m_DepthRenderTarget = value;
    }

    /// <summary>
    ///   <para>Load actions for color buffers.</para>
    /// </summary>
    public RenderBufferLoadAction[] colorLoadActions
    {
      get => this.m_ColorLoadActions;
      set => this.m_ColorLoadActions = value;
    }

    /// <summary>
    ///   <para>Store actions for color buffers.</para>
    /// </summary>
    public RenderBufferStoreAction[] colorStoreActions
    {
      get => this.m_ColorStoreActions;
      set => this.m_ColorStoreActions = value;
    }

    /// <summary>
    ///   <para>Load action for the depth/stencil buffer.</para>
    /// </summary>
    public RenderBufferLoadAction depthLoadAction
    {
      get => this.m_DepthLoadAction;
      set => this.m_DepthLoadAction = value;
    }

    /// <summary>
    ///   <para>Store action for the depth/stencil buffer.</para>
    /// </summary>
    public RenderBufferStoreAction depthStoreAction
    {
      get => this.m_DepthStoreAction;
      set => this.m_DepthStoreAction = value;
    }

    /// <summary>
    ///   <para>Optional flags.</para>
    /// </summary>
    public RenderTargetFlags flags
    {
      get => this.m_Flags;
      set => this.m_Flags = value;
    }

    /// <summary>
    ///   <para>Constructs RenderTargetBinding.</para>
    /// </summary>
    /// <param name="color">Color buffers to use as render targets.</param>
    /// <param name="depth">Depth buffer to use as render target.</param>
    /// <param name="colorLoadAction">Load actions for color buffers.</param>
    /// <param name="colorStoreAction">Store actions for color buffers.</param>
    /// <param name="depthLoadAction">Load action for the depth/stencil buffer.</param>
    /// <param name="depthStoreAction">Store action for the depth/stencil buffer.</param>
    /// <param name="colorRenderTarget"></param>
    /// <param name="depthRenderTarget"></param>
    /// <param name="colorRenderTargets"></param>
    /// <param name="colorLoadActions"></param>
    /// <param name="colorStoreActions"></param>
    /// <param name="setup"></param>
    public RenderTargetBinding(
      RenderTargetIdentifier[] colorRenderTargets,
      RenderBufferLoadAction[] colorLoadActions,
      RenderBufferStoreAction[] colorStoreActions,
      RenderTargetIdentifier depthRenderTarget,
      RenderBufferLoadAction depthLoadAction,
      RenderBufferStoreAction depthStoreAction)
    {
      this.m_ColorRenderTargets = colorRenderTargets;
      this.m_DepthRenderTarget = depthRenderTarget;
      this.m_ColorLoadActions = colorLoadActions;
      this.m_ColorStoreActions = colorStoreActions;
      this.m_DepthLoadAction = depthLoadAction;
      this.m_DepthStoreAction = depthStoreAction;
      this.m_Flags = RenderTargetFlags.None;
    }

    /// <summary>
    ///   <para>Constructs RenderTargetBinding.</para>
    /// </summary>
    /// <param name="color">Color buffers to use as render targets.</param>
    /// <param name="depth">Depth buffer to use as render target.</param>
    /// <param name="colorLoadAction">Load actions for color buffers.</param>
    /// <param name="colorStoreAction">Store actions for color buffers.</param>
    /// <param name="depthLoadAction">Load action for the depth/stencil buffer.</param>
    /// <param name="depthStoreAction">Store action for the depth/stencil buffer.</param>
    /// <param name="colorRenderTarget"></param>
    /// <param name="depthRenderTarget"></param>
    /// <param name="colorRenderTargets"></param>
    /// <param name="colorLoadActions"></param>
    /// <param name="colorStoreActions"></param>
    /// <param name="setup"></param>
    public RenderTargetBinding(
      RenderTargetIdentifier colorRenderTarget,
      RenderBufferLoadAction colorLoadAction,
      RenderBufferStoreAction colorStoreAction,
      RenderTargetIdentifier depthRenderTarget,
      RenderBufferLoadAction depthLoadAction,
      RenderBufferStoreAction depthStoreAction)
      : this(new RenderTargetIdentifier[1]
      {
        colorRenderTarget
      }, new RenderBufferLoadAction[1]{ colorLoadAction }, new RenderBufferStoreAction[1]
      {
        colorStoreAction
      }, depthRenderTarget, depthLoadAction, depthStoreAction)
    {
    }

    /// <summary>
    ///   <para>Constructs RenderTargetBinding.</para>
    /// </summary>
    /// <param name="color">Color buffers to use as render targets.</param>
    /// <param name="depth">Depth buffer to use as render target.</param>
    /// <param name="colorLoadAction">Load actions for color buffers.</param>
    /// <param name="colorStoreAction">Store actions for color buffers.</param>
    /// <param name="depthLoadAction">Load action for the depth/stencil buffer.</param>
    /// <param name="depthStoreAction">Store action for the depth/stencil buffer.</param>
    /// <param name="colorRenderTarget"></param>
    /// <param name="depthRenderTarget"></param>
    /// <param name="colorRenderTargets"></param>
    /// <param name="colorLoadActions"></param>
    /// <param name="colorStoreActions"></param>
    /// <param name="setup"></param>
    public RenderTargetBinding(RenderTargetSetup setup)
    {
      this.m_ColorRenderTargets = new RenderTargetIdentifier[setup.color.Length];
      for (int index = 0; index < this.m_ColorRenderTargets.Length; ++index)
        this.m_ColorRenderTargets[index] = new RenderTargetIdentifier(setup.color[index], setup.mipLevel, setup.cubemapFace, setup.depthSlice);
      this.m_DepthRenderTarget = (RenderTargetIdentifier) setup.depth;
      this.m_ColorLoadActions = (RenderBufferLoadAction[]) setup.colorLoad.Clone();
      this.m_ColorStoreActions = (RenderBufferStoreAction[]) setup.colorStore.Clone();
      this.m_DepthLoadAction = setup.depthLoad;
      this.m_DepthStoreAction = setup.depthStore;
      this.m_Flags = RenderTargetFlags.None;
    }
  }
}
